<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>登录</title>
<link rel="stylesheet" type="text/css"
	href="jquery/themes/bootstrap/easyui.css">
<link rel="stylesheet" type="text/css" href="jquery/themes/icon.css">
<script type="text/javascript" src="jquery/jquery.min.js"></script>
<script type="text/javascript" src="jquery/jquery.easyui.min.js"></script>
<script type="text/javascript" src="jquery/easyui-lang-zh_CN.js"></script>
<script type="text/javascript">
if (window.history && window.history.pushState) {
    $(window).on('popstate', function () { 
        window.history.pushState('forward', null, ''); 
        window.history.forward(1);
    });
}
window.history.pushState('forward', null, '');  //在IE中必须得有这两行
window.history.forward(1);
	$(function() {
		$("#login-dialog").dialog({
			buttons:[{
				text:'登录',
				iconCls:'icon-man',
				handler:function(){
					$('#login-form').form('submit', {   
					    url:'login',   
					    onSubmit: function(){   
					       return   $('#login-form').form('validate');
					    },   
					    success:function(flag){   
					        if(flag=="-1"){
					        	$("#email-error").html("<font color='red'>输入邮箱不存在</font>");
					        	return false;
					        }else{
					        	$("#email-error").html("");
					        } 
					        if(flag=="0"){
					        	$("#account-error").html("<font color='red'>账号输入不正确</font>");
					        	return false;
					        }  else{
					        	$("#account-error").html("");
					        }
					        if(flag=="-2"){
					        	$("#sys-error").html("<font color='red'>系统出现故障</font>");
					        	return false;
					        }
					        if(flag=='1'){
					        	window.location.href='index.jsp';
					        }
					    }   
					}); 
					
				}
			}]
			
			

		})

	})
</script>

</head>
<body>
     <div id="sys-error" align="center"></div>
	<div id="login-dialog" class="easyui-dialog" title="登录"
		style="width: auto; height: auto;"
		data-options="modal:true,closable:false">
		<form id="login-form" method="post">
			<table>
				<tr>
					<td>用户邮箱&nbsp;&nbsp;:</td>
					<td><input name="email" class="easyui-validatebox"
						data-options="required:true,validType:'email'" />
						<div id="email-error"></div></td>
				</tr>
				<tr>
					<td>用户账号&nbsp;&nbsp;:</td>
					<td><input name="account" type="password"
						class="easyui-validatebox"
						data-options="required:true" />
						<div id="account-error"></div>
						</td>
				</tr>

			</table>
		</form>
	</div>

</body>
</html>